package com.abel.bigwater.wflow.mapper

import com.abel.bigwater.model.ticket.*
import org.apache.ibatis.annotations.Mapper

@Mapper
interface TicketMapper {
    fun createTicket(ticket: LossTicket): Int

    fun updateTicketByValue(ticket: LossTicket): Int

    fun deleteTicket(ticket: LossTicket): Int

    /**
     * 按发起时间逆序排列
     */
    fun listTicket(tp: TicketParam): List<LossTicket>?

    fun ticketById(tp: TicketParam): LossTicket?

    /**
     * 按DMA统计工单
     */
    fun statTicketByDma(tp: TicketParam): List<TicketStat>?

    /**
     * 按材质统计工单
     */
    fun statTicketByStuff(tp: TicketParam): List<TicketStat>?

    /**
     * 按漏损原因统计
     */
    fun statTicketByLossReason(tp: TicketParam): List<TicketStat>?

    /**
     * 按终止原因统计
     */
    fun statTicketByCancelReason(tp: TicketParam): List<TicketStat>?

    /**
     * 水表脉冲比调整工单
     */
    fun createSetupMeter(sm: SetupMeter): Int

    fun updateSetupMeter(sm: SetupMeter): Int

    fun selectSetupMeter(sm: SetupMeter): SetupMeter?

    fun meterHistoryPulse(pulse: MeterHistoryPulse): List<MeterHistoryPulse>?

    fun updateHistoryPulse(pulse: MeterHistoryPulse): Int?
}